home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
C
/
Frameworks
/
TransSkel 3.24
/
Demos
/
Pascal Demos
/
Button
/
Modal1.p
< prev
next >
Wrap
Text File
|
1996-01-24
|
2KB
|
79 lines
unit Modal1;
interface
uses
Types, QuickDraw, Windows, Dialogs, OSUtils, ButtonGlobals, TransSkel;
procedure DoModal1;
implementation
const
iOK = 1;
iCancel = 2;
iEditText = 3;
iOutline = 4;
{--------------------------------------------------------------------}
{ Dialog 1 procedures }
{--------------------------------------------------------------------}
procedure DoModal1;
var
filter: ModalFilterUPP;
dlog: DialogPtr;
savePort: GrafPtr;
item: Integer;
str: Str255;
hilite: Integer;
loop: Boolean;
begin
dlog := GetNewDialog(modal1Res, nil, WindowPtr(-1));
if (dlog = DialogPtr(nil)) then
begin
SysBeep(1);
exit(DoModal1);
end;
SkelPositionWindow(dlog, skelPositionOnMainDevice, horizRatio, vertRatio);
GetPort(savePort);
SetPort(dlog);
SkelSetDlogButtonOutliner(dlog, iOutline);
SkelSetDlogStr(dlog, iEditText, 'Default button is active only when this field is non-empty');
SelectDialogItemText(dlog, iEditText, 0, 32767);
ShowWindow(dlog);
loop := true;
while (loop) do
begin
filter := SkelDlogFilter(nil, true);
SkelDlogCancelItem(iCancel);
SkelDlogTracksCursor(true);
ModalDialog(filter, item);
SkelRmveDlogFilter;
if ((item = iOK) or (item = iCancel)) then
loop := false
else
begin
SkelGetDlogStr(dlog, iEditText, str);
if (length(str) > 0) then
hilite := normalHilite
else
hilite := dimHilite;
if (SkelSetDlogCtlHilite(dlog, iOK, hilite)) then
SkelDrawButtonOutline(SkelGetDlogCtl(dlog, iOK));
end;
end;
DisposeDialog(dlog);
SetPort(savePort);
end;
end.